.TH REFER 1
.SH NAME
refer, lookbib \- find and insert literature references in documents
.SH SYNOPSIS
.B refer
[ option ] ...
.PP
.B lookbib
[ file ] ...
.SH DESCRIPTION
.I Lookbib
accepts keywords from the standard input 
and searches a bibliographic data base for references
that contain those keywords anywhere in title, author,
journal name, etc.
Matching references are printed on the standard output.
Blank lines are taken as delimiters between queries.
.PP
.I Refer
is a preprocessor for
.I nroff
or
.IR troff (1)
that finds and formats references.
The input files (standard input default) are copied to the standard output,
except for lines between .[ and .]
command lines, which are assumed to contain keywords as for
.I lookbib,
and are replaced by information from the bibliographic data base.
The user may avoid the search, override fields from it, or
add new fields.
The reference data, from whatever source, are assigned to a set of
.I troff
strings.
Macro packages such as
.IR ms (7)
print the finished reference text from these strings.
A flag is placed in the text at the point of reference;
by default the references are indicated by numbers.
.br
.sp
The following options are available:
.TP 6
.BI \-a r
Reverse the first
.I r
author names (Jones, J. A. instead of J. A. Jones).
If
.I r
is omitted all author names are reversed.
.ns
.TP
.B \-b
Bare mode: do not put any flags in text (neither numbers nor labels).
.ns
.TP
.BI \-c string
Capitalize (with C\s-2APS\s0 S\s-2MALL\s+2 C\s-2APS\s0)
the fields whose key-letters are in
.IR string .
.ns
.TP
.B \-e
Instead of leaving the references where encountered,
accumulate them
until a sequence of the form
.nf
		.[
		$LIST$
		.]
.fi
is encountered, and then write out all references
collected so far.  Collapse references to the same source.
.ns
.TP
.BI \-k x
Instead of numbering references, use labels as specified in
a
reference data line
beginning
.I %x;
by default 
.I x
is
.B L.
.ns
.TP
.BI \-l m , n
Instead of numbering references, use labels made from
the senior author's last name and the year of publication.
Only the first
.I m
letters of the last name
and the last
.I n
digits of the date are used.
If either
.I m
or
.BI , n
is omitted the entire name or date respectively is used.
.ns
.TP
.B \-p
Take the next argument as a file of
references to be searched.
The default file is searched last.
.ns
.TP
.B \-n
Do not search the default file.
.ns
.TP
.BI \-s keys
Sort references by fields whose key-letters are in
the
.I keys
string;
permute
reference numbers in text accordingly.
Implies
.BR \-e .
The key-letters in
.I keys
may be followed by a number to indicate how many such fields
are used, with
.B +
taken as a very large number.
The default is
.B AD
which sorts on the senior author and then date; to sort, for example,
on all authors and then title use
.BR -sA+T .
.PP
To use your own references, put them in the format
described in
.IR pubindex (1)
They can be searched
more rapidly by running
.IR pubindex (1)
on them before using
.I refer;
failure to index results in a linear search.
.PP
When
.I refer
is used with
.I eqn,
.I neqn
or
.I tbl,
.I refer
should be first, to minimize the volume
of data passed through
pipes.
.SH FILES
.I /usr/dict/papers
directory of default publication lists and indexes
.br
.I /usr/lib/refer
directory of programs
.SH SEE ALSO
.br
